<%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=UTF-8" %>
<%@ include file="/resources/modular/plugin/taglibs.jsp" %>
<!doctype html>
<head content="-我的">
    <%@ include file="/resources/modular/head/inside_head.jsp" %>
    <link rel="stylesheet" href="${basePath}resources/css/v2/paging.css">
</head>
<body class="GC_Menu_7" name="GC_indvidual">

<%@ include file="/resources/modular/plugin/mainMenu.jsp" %>

<div class="page" name="GC_individual_balance">

    <%@ include file="/resources/modular/plugin/mainTopMenu.jsp" %>

    <%@ include file="/resources/modular/plugin/individualMeun.jsp" %>

    <div class="page_right">

        <div class="my_bindBankcard_dv">
            <p class="my_cash_title">
                <a id="GC_balance_notransfer" class="cur" href="javascript:void(0);">未体现</a>
                <c:if test="${GC_cashBalance != '0.00'}">
                    <a id="GC_balance_alreadyransfer" href="javascript:void(0);">已提现</a>
                </c:if>
            </p>

            <div class="my_cash_dv" style="display: block;" id="GC_balance_cantransferbalance">
                <p>余额</p>
                <c:set var="GC_cashBalance" value="${money}" scope="session"/>
                <strong>${GC_cashBalance}</strong>
                <c:if test="${GC_cashBalance != '0.00'}">
                    <a class="my_cash_dv_btn" href="javascript:void(0);">提现</a>
                </c:if>
            </div>


            <ul class="my_cash_overul" style="display: none;" id="GC_balance_transferinfo">
                <%-- 动态追加内容 --%>
            </ul>
            <%--<div id="GC_balance_transferinfo_pageing" style="margin:30px 0 50px;display: none; line-height: 22px;">
                <div id="kkpager"></div>
            </div>--%>
            <div class="pagedv" id="GC_balance_transferinfo_pageing" style="margin:30px 0 50px;display: none;">
                <div class="page_dv"></div>
            </div>
        </div>

    </div>
</body>
</html>
<%@ include file="/resources/modular/foot/inside_footer.jsp" %>
<script language="javascript" src="${basePath}resources/js/v2/utils.js"></script>
<script src="${basePath}resources/js/v2/paging.js"></script>
<script type="text/javascript">

    var pageindex = 0;
    var totalRecord = 0;


    $("#GC_balance_notransfer").click(function () {
        $(".my_cash_title").children("a").removeClass("cur");
        $(this).addClass("cur");
        $("#GC_balance_cantransferbalance").show();
        $("#GC_balance_transferinfo").hide();
        $("#GC_balance_transferinfo_pageing").hide();
    });

    $("#GC_balance_alreadyransfer").click(function () {
        $(".my_cash_title").children("a").removeClass("cur");
        $(this).addClass("cur");
        $("#GC_balance_cantransferbalance").hide();
        $("#GC_balance_transferinfo").show();
        $("#GC_balance_transferinfo_pageing").show();
        <%-- 点击"已提现"选项卡时,触发提现流水的业务 --%>
        <%-- 1.获取最新10条的提现流水记录 --%>
        <%-- 2.获取提现流水记录分页的最大页数 --%>
        if (pageindex == 0) {
            pageindex = 1;
            getBalanceDetail(pageindex);

            getTotalRecord();
            /*getBalanceDetail(pageindex);*/

        }

    });

    <%-- 获取提现流水帐 --%>
    function getBalanceDetail(pagenumber) {

        $.ajax({
            url: '${basePath}v2/individual/showbalancedatail',
            type: 'GET',
            data: {
                "page": pagenumber
            },
            error: function (response) {
                $errorMsg(response);
            },
            success: function (ret) {
                if (ret.result) {
                    $("#GC_balance_transferinfo").children().remove();
                    $.each(ret.details, function (i, detail) {
                        $("#GC_balance_transferinfo").append("<li id='" + detail.cashDetailID + "'><span>" + detail.cashWhereabouts + "<br>" + detail.cachAmount + "</span><span>" + detail.cachState + "<br>" + fordate(detail.cashTime) + "</span></li>");
                    });
                } else {
                    alert(ret.info);
                }
            }
        });
    }
    <%-- 获取提现流水帐分页的最大页数 --%>
    function getTotalRecord() {
        $.ajax({
            url: '${basePath}v2/individual/getdatailtotalrecord',
            type: 'GET',
            error: function (response) {
                $errorMsg(response);
            },
            success: function (ret) {
                if (ret.result) {
                    totalRecord = ret.TotalRecord;
                    console.dir(totalRecord);

                    $(".pagedv").paging({
                        "container": ".pagedv",
                        "indexmax": totalRecord,
                        "indexcur": 1,
                        "flag": true,
                        "clickevent": function (flag, indexcur) {
                            if (flag) {
                                getBalanceDetail(indexcur);
                            }
                        },
                    });



                } else {
                    totalRecord = 0;
                    alert(ret.info);
                }
            }
        });
    }

    <%-- 点击提现按钮时，打开新的选项卡进入提现页面 --%>
    $(".my_cash_dv_btn").click(function () {
        //window.open('showtransferbalanceView','Derek','height=500,width=500,status=yes,toolbar=yes,menubar=no,location=no');
        window.open('showtransferbalanceView', 'Derek');
    });
</script>